package com.atguigu.demo0428.customer.service.impl;

import com.atguigu.demo0428.customer.bean.Customer;
import com.atguigu.demo0428.customer.mapper.CustomerMapper;
import com.atguigu.demo0428.customer.service.CustomerService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@DS("mysql0428")
public class CustomerServiceImpl  extends ServiceImpl<CustomerMapper,Customer> implements CustomerService {

    @Autowired
    CustomerMapper customerMapper;

    @Override
    public void saveCustomer(Customer customer) {

        System.out.println("服务层 保存 ："+customer);


        customerMapper.insertCustomer(customer); //0224

        customerMapper.insert(customer); //0428


    }


    public List<Customer>  getCustomerListByName(String name){
       // List<Customer> customerList = customerMapper.getCustomerList(name);
        List<Customer> customerList1 =
                customerMapper.selectList(new QueryWrapper<Customer>().eq("customer_name", name));


        return customerList1;
    }
}
